<%@ page import="com.jspsmart.upload.SmartUpload" %>
<%@ page import="com.jspsmart.upload.Request" %>
<%@ page import="entity.Topic" %>
<%@ page import="entity.Users" %>
<%@ page import="dao.ITopicDao" %>
<%@ page import="dao.impl.TopicDaoImpl" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/4/6
  Time: 13:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%

    request.setCharacterEncoding("UTF-8");
    response.setCharacterEncoding("UTF-8");
    SmartUpload sm=new SmartUpload();
    sm.initialize(pageContext);
    sm.setCharset("UTF-8");
    sm.upload();
    sm.save("fil");
    Request srt=sm.getRequest();
    Integer id= (Integer) session.getAttribute("id");
    String title=srt.getParameter("title");
    String txt=srt.getParameter("mcontent");
    String pic=sm.getFiles().getFile(0).getFileName();
    Topic tc=new Topic(title,txt,pic);
    ITopicDao itd=new TopicDaoImpl();
    int b=itd.updPublish(tc,id);
    if (b>0){
        out.print("<script>alert('修改成功');location.href='main.jsp';</script>");
    }else {
        out.print("<script>alert('修改失败');location.href='main.jsp';</script>");
    }

/*String pic=request.getParameter("pic");*/


%>

</body>
</html>
